<?php
/**
 * @ProjectName:  PHP开发APP接口
 * @Package:      lib\JsonResponse
 * @ClassName:    JsonResponse
 * @Description:  Json通信方式封装
 * @Author:       wuliang@boqii.com
 * @CreateDate:   2016-03-20 20:20
 * @Version:      [v1.0]
 */

namespace lib;


class JsonResponse 
{
    /**
     * 获取json形式通信数据
     * @param integer $code
     * @param string $message
     * @param array $data
     * @return string
     */
	public static function json ($code, $message = '', $data = array())
    {
        $result = array(
            'code'    => $code,
            'message' => $message,
            'data'    => $data
        );

        return json_encode($result);
    }
}